package router

import (
	"k8s-admin/controller/system"
	task2 "k8s-admin/controller/task"
	terminal "k8s-admin/controller/terminal"
	"k8s-admin/middleware"

	"github.com/gin-gonic/gin"
)

func InitRoute() *gin.Engine {
	r := gin.Default()
	r.Use(middleware.Cors())
	r.POST("/login", system.Login)
	r.GET("/health", system.Health)
	r.GET("/ws", terminal.ShellWs)
	task := r.Group("/task", middleware.CasbinMiddle(), middleware.ChecKToken())
	{
		task.POST("taskCreate", task2.TaskCreate)
		task.GET("taskLists", task2.TaskLists)
		task.GET("startTask", task2.StartTask)
		task.GET("taskHistory", task2.TaskHistory)
		task.DELETE("taskDelete", task2.TaskDelete)
		task.PUT("taskUpdate/:task_number", task2.TaskUpdate)
		task.POST("timer/timerCreate", task2.TimerCreate)
		task.GET("timer/timerlists", task2.TimerLists)
		task.GET("timerStart/:timer_number", task2.TimerStart)

	}
	Users(r)
	Assetsmanagement(r)
	Cluster(r)
	Node(r)
	Namespace(r)
	Pod(r)
	Services(r)
	StartDeploymentRoute(r)
	StartStatefulSet(r)
	ConfigMao_Secret(r)
	DaemonSet(r)
	return r
}
